import React from 'react'
import { TodolistContext } from './App';

export const List = () => {
    return (
        <div>
            <ul>

                <TodolistContext.Consumer>
                    {/* consumer里面放的函数 */}
                    {
                        (state)=>{
                            // console.log(state)
                            return state.list.map((item, index) => <li key={index}>{item}</li>)
                        }
                    }
                </TodolistContext.Consumer>
            </ul>
        </div>
    )
}
